package dao;

import java.sql.SQLException;

import tools.Tool;

import Model.Source;

public class SourceDAO extends DAO {
	public SourceDAO()
	{
		super();
	}
	public boolean addSource(Source source)
	{
		sql="insert into source(id,upname,newname,uptime,uptype,upuserid,saveurl,upurl,des) values(?,?,?,?,?,?,?,?,?)";
		try {
			pstmt=conn.prepareStatement(sql);
			pstmt.setString(1, source.getId());
			pstmt.setString(2, source.getUpname());
			pstmt.setString(3, source.getNewname());
			pstmt.setString(4, source.getUptime());
			pstmt.setString(5, source.getUptype());
			pstmt.setString(6, source.getUpuserid());
			pstmt.setString(7, source.getSaveurl());
			pstmt.setString(8, source.getUpurl());
			pstmt.setString(9, source.getDescribe());
			if(pstmt.executeUpdate()==1)
			{
				return true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			Tool.PrintException("addsource", "sourceDAO");
		}
		return false;
	}
}
